<template>
  <div class="component">
    <div class="shadow"></div>
    <div class="main">
      <van-sidebar 
        :active-key="activeKey"
        @change="sideChange"
        :style="{
          maxHeight: 'calc(100vh - ' + contentHeight + ')'
        }"
        >
        <van-sidebar-item 
          v-for="(item, index) in list"
          :key="index"
          :title="item.name"
          />
      </van-sidebar>
      <div 
        class="cards"
        v-for="(cards, index1) in list"
        :key="index1"
        v-show="index1 === activeKey"
        :style="{
          maxHeight: 'calc(100vh - ' + contentHeight + ')'
        }"
        >
        <div v-if="index1 === activeKey">
          <div
            class="card"
            v-for="(item, index) in list[activeKey].list"
            :key="index"
            >
            <all-circle-card
              :info="item"
              />
            <van-divider/>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
// 
import {
  mapState
} from 'vuex'
export default {
  props: {
    list: {
      type: Array,
      required: true
    }
  },
  data() {
    return {
      activeKey: 0,
      tabHeight: 44
    }
  },
  methods: {
    sideChange(event) {
      const type = event.detail
      this.activeKey = type
    },
    getKey(key) {
      console.log(key)
      return key
    },
    handleMove(event) {
      console.log(event)
    }
  },
  computed: {
    contentHeight() {
      return `${
        (
          this.sysInfo.statusBarHeight 
          + this.navbarHeight 
          + this.tabbarHeight
          + this.tabHeight
        )}px`
    },
  }
}
</script>

<style lang="less" scoped>
.component {
  .main {
    display: flex;
    flex-direction: row;
    van-sidebar {
      overflow: auto;
    }
    .cards {
      box-sizing: border-box;
      overflow: auto;
      padding: 30rpx 0 0 30rpx;
    }
  }
}
</style>